<template>
  <view class="my-search-container" :style="{'background-color':bgColor}">
    <view class="my-search-box" :style="{'border-radius':radius + 'px'}" @click="searchHandler()">
       <uni-icons type="search" size="17"class="icon" color="gray"></uni-icons>
      <text class="placeholder">请输入搜索的内容</text>
      <button type="primary" class="btn-search">搜索</button>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    props:{
      // 背景颜色
      bgColor:{
        type:String,
        default:'#fff'
      },
      // 圆角尺寸
      radius:{
        type:Number,
        default:18 //px
      }
    },
    data() {
      return {
        
      }
    },
    methods:{
      searchHandler(){
        this.$emit('click')
      }
    }
  }
</script>

<style lang="scss">
.my-search-container{
  height: 50px;
  // background-color: #c00000;
  display: flex;
  align-items: center;
  padding: 0 10px;
  .my-search-box{
    height: 36px;
    // background-color: #ffffff;
    border: 1px solid #ffa200;
    // border-radius: 18px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    .icon{
      position: absolute;
      top: 7px;
      left: 7px;
    }
    .placeholder{
      font-size: 15px;
      margin-left: 5px;
      position: absolute;
      top: 7px;
      left: 25px;
      color: gray;
    }
    .btn-search{
      width: 67px;
       height: 38px;
       background-color: #ffa200;
       line-height: 38px;
       font-size: 15px;
       border-radius: 17px;
       position: absolute;
       right: -3px;
       top: -1px;
       bottom: 0;
    }
  }
}
</style>